import requests

from common import token_util


class DepartUtil:

    #封装获取部门id的方法
    @classmethod
    def get_depart_id(cls):
        url = 'http://ihrm2-test.itheima.net/api/company/department'
        header = {"Content-Type": "application/json", "Authorization": token_util.TokenUtil.token_get()}
        body = {"name": "test_depart_002", "code": "111"}
        resp = requests.post(url=url, headers=header, json=body)
        depart_id =resp.json().get('data').get('id')
        return depart_id